<!-- 模板继承 -->
{extend name="public:base" /}

<!-- 页面标题 -->
{block name="title"}Administrator{/block}

<!-- 自定义css -->
{block name="css"}{/block}

<!-- 内容区域 -->
{block name="content"}
  <div class="nav-tabs-custom">
    <ul class="nav nav-tabs">
      <li class="active"><a href="{:url('admin/site/captcha')}">{:lang('Captcha')}</a></li>
      <li class="pull-right"><a href="javascript:history.back(-1);" class="text-muted"><i class="fa fa-chevron-circle-left"></i></a></li>
    </ul>
    <div class="tab-content">
      <div class="tab-pane active">
        <form role="form" id="operate">
            <div class="row">
                <div class="col-md-6">
                    <div class="box box-solid no-border">
                        <div class="box-body">
                            <div class="form-group">
                              <label>{:lang('Chinese')}</label>
                              <div class="row">
                              <div class="col-md-12">
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_useZh" value="1"}checked{/eq} name="captcha_useZh" value="1"> {:lang('ON')}
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_useZh" value="0"}checked{/eq} name="captcha_useZh" value="0"> {:lang('OFF')}
                                    </label>
                                </div>
                              </div>
                              </div>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Background')}</label>
                              <div class="row">
                              <div class="col-md-12">
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_useImgBg" value="1"}checked{/eq} name="captcha_useImgBg" value="1"> {:lang('ON')}
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_useImgBg" value="0"}checked{/eq} name="captcha_useImgBg" value="0"> {:lang('OFF')}
                                    </label>
                                </div>
                              </div>
                              </div>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Curve')}</label>
                              <div class="row">
                              <div class="col-md-12">
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_useCurve" value="1"}checked{/eq} name="captcha_useCurve" value="1"> {:lang('ON')}
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_useCurve" value="0"}checked{/eq} name="captcha_useCurve" value="0"> {:lang('OFF')}
                                    </label>
                                </div>
                              </div>
                              </div>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Noise')}</label>
                              <div class="row">
                              <div class="col-md-12">
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_useNoise" value="1"}checked{/eq} name="captcha_useNoise" value="1"> {:lang('ON')}
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_useNoise" value="0"}checked{/eq} name="captcha_useNoise" value="0"> {:lang('OFF')}
                                    </label>
                                </div>
                              </div>
                              </div>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Font size')}</label>
                              <div class="row">
                              <div class="col-md-8">
                                <div class="input-group">
                                    <input type="text" name="captcha_fontSize" value="{$captcha_fontSize}" class="form-control">
                                    <span class="input-group-addon">px</span>
                                </div>
                              </div>
                              </div>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Height')}</label>
                              <div class="row">
                              <div class="col-md-8">
                                <div class="input-group">
                                    <input type="text" name="captcha_imageH" value="{$captcha_imageH}" class="form-control">
                                    <span class="input-group-addon">px</span>
                                </div>
                              </div>
                              </div>
                              <p class="help-block"></p>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Width')}</label>
                              <div class="row">
                              <div class="col-md-8">
                                <div class="input-group">
                                    <input type="text" name="captcha_imageW" value="{$captcha_imageW}" class="form-control">
                                    <span class="input-group-addon">px</span>
                                </div>
                              </div>
                              </div>
                              <p class="help-block"></p>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Length')}</label>
                              <div class="row">
                              <div class="col-md-8">
                                <div class="input-group">
                                    <input type="text" name="captcha_length" value="{$captcha_length}" class="form-control">
                                    <span class="input-group-addon">{:lang('Character')}</span>
                                </div>
                              </div>
                              </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="box box-solid no-border">
                        <div class="box-body">
                            <div class="form-group">
                              <label>{:lang('Register')}</label>
                              <div class="row">
                              <div class="col-md-12">
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_member_register" value="1"}checked{/eq} name="captcha_member_register" value="1"> {:lang('ON')}
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_member_register" value="0"}checked{/eq} name="captcha_member_register" value="0"> {:lang('OFF')}
                                    </label>
                                </div>
                              </div>
                              </div>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Login')}</label>
                              <div class="row">
                              <div class="col-md-12">
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_member_login" value="1"}checked{/eq} name="captcha_member_login" value="1"> {:lang('ON')}
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_member_login" value="0"}checked{/eq} name="captcha_member_login" value="0"> {:lang('OFF')}
                                    </label>
                                </div>
                              </div>
                              </div>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Publish')}</label>
                              <div class="row">
                              <div class="col-md-12">
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_publish_document" value="1"}checked{/eq} name="captcha_publish_document" value="1"> {:lang('ON')}
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_publish_document" value="0"}checked{/eq} name="captcha_publish_document" value="0"> {:lang('OFF')}
                                    </label>
                                </div>
                              </div>
                              </div>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Comments')}</label>
                              <div class="row">
                              <div class="col-md-12">
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_publish_comment" value="1"}checked{/eq} name="captcha_publish_comment" value="1"> {:lang('ON')}
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_publish_comment" value="0"}checked{/eq} name="captcha_publish_comment" value="0"> {:lang('OFF')}
                                    </label>
                                </div>
                              </div>
                              </div>
                            </div>
                            <div class="form-group">
                              <label>{:lang('Feedback')}</label>
                              <div class="row">
                              <div class="col-md-12">
                                <div class="radio">
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_publish_feedback" value="1"}checked{/eq} name="captcha_publish_feedback" value="1"> {:lang('ON')}
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" {eq name="captcha_publish_feedback" value="0"}checked{/eq} name="captcha_publish_feedback" value="0"> {:lang('OFF')}
                                    </label>
                                </div>
                              </div>
                              </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
      </div>
      <!-- /.tab-pane -->
    </div>
    <!-- /.tab-content -->
    <div class="box-footer">
        <div class="btn-group">
            <button class="btn btn-primary btn-flat" onclick="operate();" type="submit"><i class="fa fa-save"></i> {:lang('Save')}</button>
        </div>
    </div>
  </div>
{/block}

<!-- 自定义js -->
{block name="js"}
<script type="text/javascript">
    function operate(){
        $.ajax({
            url:"{:url('admin/site/captcha')}",
            data:$("#operate").serialize(),
            type:'post',
            dataType:'json',
            success:function(xhr){
                if(xhr.code == 200){
                    swal({
                      position: 'center',
                      type: 'success',
                      title: xhr.msg,
                      showConfirmButton: false,
                      toast:false,
                      timer: 2000
                    });
                } else{
                    swal({
                      position: 'center',
                      type: 'error',
                      title: xhr.msg,
                      showConfirmButton: false,
                      toast:false,
                      timer: 2000
                    });
                }
            }
        });
    }

</script>
{/block}